import $api from './server';

// 添加管理员
export const  addAdmin = async (data)=>{
    let res = await $api.post('/admin/add',data)
    return res.data;

}


// 管理员登录
export const loginAdmin = async (data)=>{
    let res = await $api.post('/admin/login',data)
    const {name} = data     

      
  const menu1 =  [
    {
        name:'首页',
        url: '/index'
    },
    {
        name:'设置',
        children:[
            { name:'房型维护',url:'/setroom' },
           { name:'楼栋楼层',url:'/setbuild' },
           { name:'房间管理',url:'/roomlist' }
        ]
    }

]

const menu2 =  [
  {
      name:'首页',
      url: '/index'
  },
  {
      name:'设置',
      children:[
          { name:'房型维护',url:'/setroom' },
      ]
  }

]

if(name == 'admin1') return { success:true,data:{id:1},menu:menu1}
if(name == 'admin2') return { success:true,data:{id:1},menu:menu2}

    // return res.data;

    // return {success:true,data:{ name:'himan' }}
}

